//
//  LoginViewController.m
//  ToYourHeartNews
//
//  Created by XJing on 16/1/20.
//  Copyright © 2016年 www.lanou3g.com 蓝鸥. All rights reserved.
//

#import "LoginViewController.h"
#import "RegisterViewController.h"
@interface LoginViewController ()

@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    //账号
    UILabel *name = [[UILabel alloc]initWithFrame:CGRectMake(self.view.frame.size.width / 10, 90, self.view.frame.size.width / 8, self.view.frame.size.width / 8)];
    name.text = @"账号:";
    [self.view addSubview:name];
    UITextField *nameTextField = [[UITextField alloc]initWithFrame:CGRectMake(name.frame.origin.x + name.frame.size.width, name.frame.origin.y, self.view.frame.size.width - self.view.frame.size.width / 3, name.frame.size.height)];
//    nameTextField.backgroundColor = [UIColor redColor];
    nameTextField.placeholder = @"请输入账号";
    nameTextField.borderStyle = UITextBorderStyleRoundedRect;
    [self.view addSubview:nameTextField];
    
    //密码
    UILabel *pwd = [[UILabel alloc]initWithFrame:CGRectMake(self.view.frame.size.width / 10, 100 + name.frame.size.height, self.view.frame.size.width / 8, self.view.frame.size.width / 8)];
    pwd.text = @"密码:";
    [self.view addSubview:pwd];
    
    UITextField *pwdTextField = [[UITextField alloc]initWithFrame:CGRectMake(pwd.frame.origin.x + pwd.frame.size.width, pwd.frame.origin.y, self.view.frame.size.width - self.view.frame.size.width / 3, name.frame.size.height)];
    pwdTextField.placeholder = @"请输入密码";
    pwdTextField.borderStyle = UITextBorderStyleRoundedRect;
    [self.view addSubview:pwdTextField];
    
    //找回密码
    UIButton *findPwd = [UIButton buttonWithType:UIButtonTypeSystem];
    findPwd.frame = CGRectMake(self.view.frame.size.width / 4 * 3, pwdTextField.frame.origin.y + pwdTextField.frame.size.height + 10, self.view.frame.size.width / 4, 30);
    [findPwd setTitle:@"忘记密码?" forState:UIControlStateNormal];
    [findPwd setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.view addSubview:findPwd];
                        
    
    //登陆按钮
    UIButton *loginBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    loginBtn.frame = CGRectMake(name.frame.origin.x, self.view.frame.size.height / 2 - 20, self.view.frame.size.width / 4, 30);
    loginBtn.backgroundColor = [UIColor cyanColor];
    [loginBtn setTitle:@"登录" forState:UIControlStateNormal];
    [self.view addSubview:loginBtn];
    
    //注册按钮
    UIButton *RegisterBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    RegisterBtn.frame = CGRectMake(loginBtn.frame.origin.x + loginBtn.frame.size.width + 100, self.view.frame.size.height / 2 - 20, self.view.frame.size.width / 4, 30);
    RegisterBtn.backgroundColor = [UIColor orangeColor];
    [RegisterBtn setTitle:@"注册" forState:UIControlStateNormal];
    [RegisterBtn addTarget:self action:@selector(registerAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:RegisterBtn];
}
-(void)registerAction
{
    RegisterViewController *registerVC = [[RegisterViewController alloc]init];
    [self.navigationController pushViewController:registerVC animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
